Hi...
The safest way to configure this is to add two contacts to
the E-Stop button and use them to ground the FWD/REV
terminals. Use one to tell the controller that E-Stop has
been invoked and to execute the E-Stop routine for the
servos. Depending on your servo/stepper drives there may
be an E-Stop system as well. After everything stops THEN
disable the power circuits. You can do this with safety
timing relays ideally, or with a routine in the
controller.
Note that your VFD has a braking resistor that could
overheat, the VFD will freewheel after that happens. You
need to do some calculations on the inertia of the system
to find out of the VFD can brake the load. If not, then
you may be able to add an outboard braking resistor to
help. Failing THAT there are other strategies to safe your
machinery.
Please do not rely on software for safety!
Miguel